<template>
  <div>
    <NavBar style="z-index: 10;">
      <van-icon slot="left" name="arrow-left" @click="goBack"/>
      <div slot="title" class="van-nav-bar__title van-ellipsis">详情</div>
    </NavBar>
    <div class="swiperInfo" v-html='swiperInfo'></div>
  </div>
</template>

<script>
import NavBar from '@/components/navbar'
import https from '@/common/https.js'
export default {
  name: 'swipeDetail',
  components: {
    NavBar
  },
  data () {
    return {
      value: '',
      swiperInfo: '',
      swiperId: ''
    }
  },
  created () {
    console.log('----------swiperDetail created-----------')
    this.swiperId = this.$route.query.swiperId
    this.getSwiperData()
  },
  mounted () {
  },
  activated () {
    console.log('----------swiperDetail activated-----------')

  },
  methods: {
    goBack () {
      this.$router.go(-1)
      this.$router.push('index')
    },
    getSwiperData () { // http获取轮播图数据
      let params = {}
      params.swiperId = this.swiperId
      https.fetchPost('/swiper/webs/findSwiperInfo', params).then((data) => {
        let swiper = data.data
        if (swiper !== null) {
          this.swiperInfo = swiper
        } else {
          this.swiperInfo = '无'
        }
      }).catch(err => {
        console.log(err)
      })
    }
  }
}
</script>

<style scoped>
  .swiperInfo {
    margin-top: 50px;
    text-align: left;
    font-size: 14px;
  }
</style>
